#ifndef PCAP_WRAPPER_H_H_H
#define PCAP_WRAPPER_H_H_H

#include <pcap.h>
#include <string>
#include <thread>

class PcapWrapper
{
public:
    PcapWrapper(const char *devName, const char *filter);
    ~PcapWrapper();

public:
    bool initialize(const char *savefile = nullptr);
    void run();
    void destroy();

private:
    void        pcapTaskThread();
    static void gotPacket(unsigned char *args, const struct pcap_pkthdr *header, const unsigned char *packet);

private:
    std::thread    m_thread;
    pcap_t        *m_handle;
    std::string    m_dev;
    std::string    m_filter;
    pcap_dumper_t *m_dumper;
};

#endif